package com.yzs.controller.admin;

import com.yzs.common.bean.R;
import com.yzs.entity.Personnel;
import com.yzs.service.IPersonnelService;
import com.yzs.service.Impl.PersonnelServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@CrossOrigin
@RequestMapping("/personnel")
public class PersonnelController {
    @Autowired
    IPersonnelService ps = new PersonnelServiceImpl();

    @RequestMapping("/getPersonnel")
    public R getPersonnel(@RequestParam String type){
        return ps.getPersonnel(type);
    }

    @RequestMapping("/getPersonnelByPage")
    public R getPersonnel(@RequestParam String type,@RequestParam Integer currentPage,@RequestParam Integer pageSize){
        return ps.getPersonnelByPage(type,currentPage,pageSize);
    }

    @RequestMapping("/addPersonnel")
    public R addPersonnel(@RequestBody Personnel personnel){
        return ps.addPersonnel(personnel);
    }

    @RequestMapping("/updatePersonnel")
    public R updatePersonnel(@RequestBody Personnel personnel){
        return ps.updatePersonnel(personnel);
    }

    @RequestMapping("/deletePersonnel")
    public R deletePersonnel(@RequestBody Personnel personnel){
        return ps.deletePersonnel(personnel);
    }
}
